import React, { FC, createElement } from 'react';
import { BaseWrapper } from '../base';
import { useFormContainerSelector } from '../../form-container';
import { BRichEditor } from './rich-editor';
import Editor from './rich-editor/QuillRichEditor';

export interface FieldRichProps {
  max: string;
}

export const FieldRich: FC<FieldRichProps> = (props) => {
  const { value, onChange, columnConfig, defaultValue, ...otherProps } = props;
  const [readonly] = useFormContainerSelector((s) => [s.readonly]);

  return (
    <BaseWrapper {...props}>
      <BRichEditor
        disabled={readonly || columnConfig?.status === '2'}
        placeholder={columnConfig?.placeholder}
        initialValue={value}
        onChange={onChange}
      />
      {/* <Editor
        placeholder={columnConfig?.placeholder}
        value={defaultValue}
        onChange={onChange}
        defaultValue={defaultValue}
        readOnly={readonly || columnConfig?.status === '2'}
      /> */}
    </BaseWrapper>
  );
};
